Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 5a0cdec314d443941a0549215e97163f23ae8e08


Parents : 5e53e14
Author : Ivan <ivan@quad4.io>
Signature : Invalid signer <e46112d44649266d71fe2193e00a4710>, author is <ivan@quad4.io>
Date : 2026-06-29T07:59:54-05:00

fix(tests): streamline backend test coverage setup by ensuring coverage data directory is created and removing redundant coverage file specification

Changes

2 files changed, 22 insertions(+), 2 deletions(-)


Diff

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6ceaccf2..12ea8e3f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -116,8 +116,7 @@ jobs:
pnpm exec vitest run --config vitest.electron.config.js
;;
backend-tests)
- MESHCHAT_SKIP_STORAGE_LOCK=1 COVERAGE_FILE="${{ runner.temp }}/.coverage" \
- uv run python -m pytest tests/backend -n auto \
+ MESHCHAT_SKIP_STORAGE_LOCK=1 uv run python -m pytest tests/backend \
--cov=meshchatx/src/backend
;;
lang-tests)

diff --git a/tests/backend/conftest.py b/tests/backend/conftest.py
index ec0c1f3e..0d02b985 100644
--- a/tests/backend/conftest.py
+++ b/tests/backend/conftest.py
@@ -23,6 +23,27 @@ os.environ["MESHCHAT_SKIP_STORAGE_LOCK"] = "1"
os.environ["MESHCHAT_DISABLE_CSRF"] = "1"
+def _ensure_coverage_data_dir() -> None:
+ cov_file = os.environ.get("COVERAGE_FILE")
+ if not cov_file:
+ return
+ parent = os.path.dirname(os.path.abspath(cov_file))
+ if parent:
+ os.makedirs(parent, exist_ok=True)
+
+
+_ensure_coverage_data_dir()
+
+
+def pytest_configure(config):
+ _ensure_coverage_data_dir()
+ worker = os.environ.get("PYTEST_XDIST_WORKER")
+ cov_dir = os.environ.get("MESHCHAT_COVERAGE_DIR")
+ if worker and cov_dir:
+ os.makedirs(cov_dir, exist_ok=True)
+ os.environ["COVERAGE_FILE"] = os.path.join(cov_dir, f".coverage.{worker}")
+
+
@pytest.fixture(scope="session")
def loopback_available():
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────